<?php

namespace App\Repository;

use App\Models\SysTort;
use App\Models\SysTortAnnex;

class TortRepository extends BaseRepository
{
    public function create($params)
    {
        $loadData = [
            'report_id' => $params['report_id'],
            'user_id' => $params['user_id'],
            'tort_id' => $params['tort_id'],
            'target_id' => $params['target_id'],
            'target_type' => $params['target_type'],
            'url' => $params['url'] ?? '',
            'description' => $params['description'] ?? '',
            'contact' => $params['contact'] ?? '',
            'type' => $params['type'] ?? '',
        ];

        return SysTort::getInstance()->create($loadData);
    }

    public function createAnnex($loadData)
    {
        return SysTortAnnex::getInstance($loadData['tort_id'])->create($loadData);
    }
}
